﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebTemplate.DAL.Entities;
using WebTemplate.DAL.Repositories;
using System.Web.Security;

namespace WebTemplate.Web.Membership
{
    public partial class ResetPassword : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Submit_Click(object sender, EventArgs e)
        {
            if (this.IsValid)
            {
                MemberReprositry reprositry = new MemberReprositry();
                MembersSearchCriteria search = new MembersSearchCriteria();
                Members member = new Members();
                string hashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(this.NewPass.Text, "SHA1");
                member.Password = hashedPassword;
                member.IsActive = true;
                reprositry.Update(member);
            }

            Response.Redirect("~/membership/Login.aspx");
        }
    }
}